<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html>
	<head>
		<meta charset="utf-8">
		<title>login</title>
		<script type="text/javascript" src="${pageContext.request.contextPath}/statics/js/jquery-1.9.0.min.js"></script>
		<script type="text/javascript">
			$(function(){
				$("#submit").click(function(){
					if($("#username").val()==""||$("#password").val()==""){
						alert("用户名或密码不能为空");
						return false;
					}
					$.post("login.json",{userCode:$("#username").val(),userPassword:$("#password").val()},function(data){
						//console.log(data);
						//data
						if(data&&data.status&&data.status.code=="SUCCESS"){
							window.location="${pageContext.request.contextPath}"+data.result;
						}else{
							//alert(data.successUrl);
							//location=data.successUrl;
							//location.reload();
							console.log(data);
							alert(data.msg);
						}
					},"json");
				});
			})
		</script>
	</head> 
	<body>
		<h2>${error}</h2>
		<form action="login.htm" method="post">
		    用户名：<input type="text" name="userCode" id="username" value=""><br/>
		    密码：<input type="password" name="userPassword" id="password"><br/>
		    自动登录：<input type="checkbox" name="rememberMe" value="true"><br/>
		    <input type="submit" value="登录">
		    <input id="submit" type="button" value="dyna登录" >
		</form>
	</body>
</html>
